#pragma once
#include "../inc_windows_h.hpp"
#include "../wxx_error.hpp"

namespace wxx {
namespace com 
{
	struct com_thread
	{
		enum com_thread_type
		{
			mta = COINIT_MULTITHREADED, 
			sta = COINIT_APARTMENTTHREADED,
		};

		explicit com_thread(enum com_thread_type type = mta) throw(...)
		{
			ensure_success_hr(
				::CoInitializeEx(0, COINIT_DISABLE_OLE1DDE | type)
			);
		}

		~com_thread() throw() 
		{
			::CoUninitialize(); 
		}
	};
}}